from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('https:www.baidu.com')
# 浏览器名称
print(driver.name)
# 当前URL
print(driver.current_url)
# 当前页源码
# print(driver.page_source)
# 当前窗口句柄
# print(driver.current_window_handle)
# 浏览器所有标签句柄
driver.find_element(By.LINK_TEXT, '新闻').click()
print(driver.window_handles)
# 关闭浏览器
driver.quit()
